/*
  Part of the MasterTool3D project - http://code.google.com/p/master-tool-3d

  Copyright (c) 2011 Ingo Pueschl

  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation, version 2.1.

  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Lesser General Public License for more details.

  You should have received a copy of the GNU Lesser General
  Public License along with this library; if not, write to the
  Free Software Foundation, Inc., 59 Temple Place, Suite 330,
  Boston, MA  02111-1307  USA
*/

package techjit.home.ingo;

import techjit.gfx.core.GFX_CircleLayout;
import techjit.gfx.core.GFX_Layout;
import techjit.gfx.core.GFX_Layout.AlignmentEnum;
import techjit.gfx.core.GFX_LineLayout;
import techjit.gfx.core.GFX_Scene;
import techjit.gfx.plugins.swe.SWE_Class;
import techjit.gfx.plugins.swe.SWE_Package;
import techjit.gfx.util.geo.Dimensions;
import techjit.gfx.util.geo.Rotation;
import techjit.gfx.util.geo.Vector;

public abstract class ExampleScenes {

	public static void fillScene(GFX_Scene scene, int example) {

		switch (example) {
		case 1:
			// example1: single rotateable package
			fillScene_example1(scene);
			break;
		case 2:
			// example2: 8 packages to be aligned on a line layout
			fillScene_example2(scene);
			break;
		case 3:
			// example3: basic tree
			fillScene_example3(scene);
			break;
		case 4:
			// example4: basic tree as cone tree
			fillScene_example4(scene);
			break;
		case 5:
			// exampe5: 8 packages to be aligned on a circle layout
			fillScene_example5(scene);
			break;
		}
	}

	private static void fillScene_example1(GFX_Scene scene) {
		scene.changeRelativePosition(new Vector(1, 2, 3));

		GFX_LineLayout lineLayout1 = new GFX_LineLayout(scene);
		scene.addTopLineLayout(lineLayout1);

		SWE_Package package1 = new SWE_Package(scene);
		lineLayout1.add(package1);
		// package1.changeRotation(new Rotation(90,0,0));

		scene.changeCurrentSceneElement(package1);

	}

	private static void fillScene_example2(GFX_Scene scene) {
		GFX_LineLayout lineLayout1 = new GFX_LineLayout(scene);

		scene.addTopLineLayout(lineLayout1);
		lineLayout1.changeAlignmentY(AlignmentEnum.ADJACENT);
		lineLayout1.changeAlignmentZ(AlignmentEnum.ADJACENT);

		SWE_Package package1 = new SWE_Package(scene);
		lineLayout1.add(package1);
		package1.changeLocalDimensions(new Dimensions(1.1f, 2.1f, 3.1f));

		SWE_Package package2 = new SWE_Package(scene);
		lineLayout1.add(package2);
		package2.changeLocalDimensions(new Dimensions(1.2f, 2.2f, 3.2f));

		SWE_Package package3 = new SWE_Package(scene);
		lineLayout1.add(package3);
		package3.changeLocalDimensions(new Dimensions(1.3f, 2.3f, 3.3f));

		SWE_Package package4 = new SWE_Package(scene);
		lineLayout1.add(package4);
		package4.changeLocalDimensions(new Dimensions(1.4f, 2.4f, 3.4f));

		SWE_Package package5 = new SWE_Package(scene);
		lineLayout1.add(package5);
		package5.changeLocalDimensions(new Dimensions(1.5f, 2.5f, 3.5f));

		SWE_Package package6 = new SWE_Package(scene);
		lineLayout1.add(package6);
		package6.changeLocalDimensions(new Dimensions(1.6f, 2.6f, 3.6f));

		SWE_Package package7 = new SWE_Package(scene);
		lineLayout1.add(package7);
		package7.changeLocalDimensions(new Dimensions(1.7f, 2.7f, 3.7f));

		SWE_Package package8 = new SWE_Package(scene);
		lineLayout1.add(package8);
		package8.changeLocalDimensions(new Dimensions(1.8f, 2.8f, 3.8f));

		scene.changeCurrentSceneElement(package5);

	}

	private static void fillScene_example3(GFX_Scene scene) {
		// lineLayout1
		GFX_LineLayout lineLayout1 = new GFX_LineLayout(scene);
		scene.addTopLineLayout(lineLayout1);
		lineLayout1.changeRotation(new Rotation(0, 0, -90));
		lineLayout1.changeAlignmentY(GFX_Layout.AlignmentEnum.CENTER);
		lineLayout1.changeAlignmentZ(GFX_Layout.AlignmentEnum.CENTER);

		// package1
		SWE_Package package1 = new SWE_Package(scene);
		lineLayout1.add(package1);
		package1.changeRotation(new Rotation(0, 0, 90));

		// circleLayout1
		GFX_LineLayout circleLayout1 = new GFX_LineLayout(scene);
		lineLayout1.add(circleLayout1);
		circleLayout1.changeRotation(new Rotation(0, 0, 90));
		circleLayout1.changeAlignmentY(GFX_Layout.AlignmentEnum.REMOTE);
		circleLayout1.changeAlignmentZ(GFX_Layout.AlignmentEnum.CENTER);

		// lineLayout2
		GFX_LineLayout lineLayout2 = new GFX_LineLayout(scene);
		circleLayout1.add(lineLayout2);
		lineLayout2.changeRotation(new Rotation(0, 0, -90));
		lineLayout2.changeAlignmentY(GFX_Layout.AlignmentEnum.CENTER);
		lineLayout2.changeAlignmentZ(GFX_Layout.AlignmentEnum.CENTER);

		// package2
		SWE_Package package2 = new SWE_Package(scene);
		lineLayout2.add(package2);
		package2.changeRotation(new Rotation(0, 0, 90));

		// circleLayout2
		GFX_LineLayout circleLayout2 = new GFX_LineLayout(scene);
		lineLayout2.add(circleLayout2);
		circleLayout2.changeRotation(new Rotation(0, 0, 90));
		circleLayout2.changeAlignmentY(GFX_Layout.AlignmentEnum.REMOTE);
		circleLayout2.changeAlignmentZ(GFX_Layout.AlignmentEnum.CENTER);

		// class1
		SWE_Class class1 = new SWE_Class(scene);
		circleLayout2.add(class1);

		// class1
		SWE_Class class2 = new SWE_Class(scene);
		circleLayout2.add(class2);

		// class1
		SWE_Class class3 = new SWE_Class(scene);
		circleLayout2.add(class3);

		// package3
		SWE_Package package3 = new SWE_Package(scene);
		circleLayout1.add(package3);

		// class1
		SWE_Class class4 = new SWE_Class(scene);
		circleLayout1.add(class4);

		// current
		scene.changeCurrentSceneElement(class2);
	}

	private static void fillScene_example4(GFX_Scene scene) {
		// lineLayout1
		GFX_LineLayout lineLayout1 = new GFX_LineLayout(scene);
		scene.addTopLineLayout(lineLayout1);
		lineLayout1.changeRotation(new Rotation(0, 0, -90));
		lineLayout1.changeAlignmentY(GFX_Layout.AlignmentEnum.CENTER);
		lineLayout1.changeAlignmentZ(GFX_Layout.AlignmentEnum.CENTER);

		// package1
		SWE_Package package1 = new SWE_Package(scene);
		lineLayout1.add(package1);
		package1.changeRotation(new Rotation(0, 0, 90));

		// circleLayout1
		GFX_CircleLayout circleLayout1 = new GFX_CircleLayout(scene);
		lineLayout1.add(circleLayout1);
		circleLayout1.changeRotation(new Rotation(0, 0, 90));
		circleLayout1.changeAlignmentY(GFX_Layout.AlignmentEnum.REMOTE);
		circleLayout1.changeAlignmentZ(GFX_Layout.AlignmentEnum.CENTER);

		// lineLayout2
		GFX_LineLayout lineLayout2 = new GFX_LineLayout(scene);
		circleLayout1.add(lineLayout2);
		lineLayout2.changeRotation(new Rotation(0, 0, -90));
		lineLayout2.changeAlignmentY(GFX_Layout.AlignmentEnum.CENTER);
		lineLayout2.changeAlignmentZ(GFX_Layout.AlignmentEnum.CENTER);

		// package2
		SWE_Package package2 = new SWE_Package(scene);
		lineLayout2.add(package2);
		package2.changeRotation(new Rotation(0, 0, 90));

		// circleLayout2
		GFX_CircleLayout circleLayout2 = new GFX_CircleLayout(scene);
		lineLayout2.add(circleLayout2);
		circleLayout2.changeRotation(new Rotation(0, 0, 90));
		circleLayout2.changeAlignmentY(GFX_Layout.AlignmentEnum.REMOTE);
		circleLayout2.changeAlignmentZ(GFX_Layout.AlignmentEnum.CENTER);

		// class1
		SWE_Class class1 = new SWE_Class(scene);
		circleLayout2.add(class1);

		// class1
		SWE_Class class2 = new SWE_Class(scene);
		circleLayout2.add(class2);

		// class1
		SWE_Class class3 = new SWE_Class(scene);
		circleLayout2.add(class3);

		// package3
		SWE_Package package3 = new SWE_Package(scene);
		circleLayout1.add(package3);

		// class1
		SWE_Class class4 = new SWE_Class(scene);
		circleLayout1.add(class4);

		// current
		scene.changeCurrentSceneElement(class2);
	}

	private static void fillScene_example5(GFX_Scene scene) {
		// GFX_CircleLayout circleLayout1 = new GFX_CircleLayout(scene);
		//
		// scene.addLayout(circleLayout1);
		// circleLayout1.changeAlignmentY(AlignmentEnum.REMOTE);
		// circleLayout1.changeAlignmentZ(AlignmentEnum.REMOTE);
		//
		// SWE_Package package1 = new SWE_Package(scene);
		// circleLayout1.add(package1);
		// package1.changeLocalDimensions(new Dimensions(1.1f, 2.1f, 3.1f));
		//
		// SWE_Package package2 = new SWE_Package(scene);
		// circleLayout1.add(package2);
		// package2.changeLocalDimensions(new Dimensions(1.2f, 2.2f, 3.2f));
		//
		// SWE_Package package3 = new SWE_Package(scene);
		// circleLayout1.add(package3);
		// package3.changeLocalDimensions(new Dimensions(1.3f, 2.3f, 3.3f));
		//
		// SWE_Package package4 = new SWE_Package(scene);
		// circleLayout1.add(package4);
		// package4.changeLocalDimensions(new Dimensions(1.4f, 2.4f, 3.4f));
		//
		// SWE_Package package5 = new SWE_Package(scene);
		// circleLayout1.add(package5);
		// package5.changeLocalDimensions(new Dimensions(1.5f, 2.5f, 3.5f));
		//
		// SWE_Package package6 = new SWE_Package(scene);
		// circleLayout1.add(package6);
		// package6.changeLocalDimensions(new Dimensions(1.6f, 2.6f, 3.6f));
		//
		// SWE_Package package7 = new SWE_Package(scene);
		// circleLayout1.add(package7);
		// package7.changeLocalDimensions(new Dimensions(1.7f, 2.7f, 3.7f));
		//
		// SWE_Package package8 = new SWE_Package(scene);
		// circleLayout1.add(package8);
		// package8.changeLocalDimensions(new Dimensions(1.8f, 2.8f, 3.8f));
		//
		// scene.changeCurrentSceneElement(package5);
	}

}
